Skip to content

Conversation

@catamorphism
Copy link
Contributor

@catamorphism
Copy link
Contributor Author

Awaiting tc39/proposal-temporal#3175

Copy link
Contributor

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

We should have similar tests for formatRange, formatToParts, formatRangeToParts, and the toLocaleString methods of PlainDate, PlainYearMonth, PlainMonthDay, PlainTime, PlainDateTime, Instant, and ZonedDateTime.

assert(formatter.format(new Temporal.PlainDate(2025, 11, 4)).startsWith("11"), "formatting a PlainDate should work");
assert(formatter.format(new Temporal.PlainYearMonth(2025, 11, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work");
assert(formatter.format(new Temporal.PlainMonthDay(11, 4, "gregory")).startsWith("11"), "formatting a PlainMonthDay should work");
assert(formatter.format(new Temporal.PlainTime(14, 46)).startsWith("A"), "formatting a PlainTime should work");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit surprised by this expectation... It does match what comes out of new Date().toLocaleTimeString('en', { era: 'narrow' }), but my reading of the spec (GetDateTimeFormat) is that era isn't copied to formatOptions when constructing [[TemporalPlainTimeFormat]].

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed tc39/proposal-temporal#3175 (review) accordingly and updated this test.

Copy link
Contributor

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look correct to me. One nitpick: all the files in test/built-ins/ should move to test/intl402/ since they are only valid for implementations with Intl.

(Not merging yet because it's marked draft)

@catamorphism catamorphism changed the title DRAFT: Temporal: Add test for formatting Temporal objects with era formatter Temporal: Add test for formatting Temporal objects with era formatter Nov 17, 2025
@catamorphism catamorphism marked this pull request as ready for review November 17, 2025 20:35
@catamorphism catamorphism requested a review from a team as a code owner November 17, 2025 20:35
@catamorphism
Copy link
Contributor Author

These look correct to me. One nitpick: all the files in test/built-ins/ should move to test/intl402/ since they are only valid for implementations with Intl.

@ptomato Fixed.

(Not merging yet because it's marked draft)

Ready now!

Copy link
Contributor

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ptomato ptomato merged commit 875b3ee into tc39:main Nov 18, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants